home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / emulator / uae-0.000 / uae-0 / uae-0.6.0 / include / options.h < prev    next >
C/C++ Source or Header  |  1996-06-12  |  5KB  |  232 lines

  1.  /*
  2.   * UAE - The Un*x Amiga Emulator
  3.   *
  4.   * cpp magic
  5.   *
  6.   * Copyright 1995, 1996 Bernd Schmidt, Ed Hanway
  7.   */
  8.  
  9. typedef enum { KBD_LANG_US, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT } KbdLang;
  10.  
  11. extern int framerate;
  12. extern int produce_sound;
  13. extern int dont_want_aspect;
  14. extern int use_fast_draw;
  15. extern int use_debugger;
  16. extern int use_slow_mem;
  17. extern int use_fast_mem;
  18. extern int use_gfxlib;
  19. extern int use_xhair;
  20. extern int use_lores;
  21. extern int automount_uaedev;
  22. extern int fake_joystick;
  23. extern KbdLang keyboard_lang;
  24. extern int color_mode;
  25. extern int screen_res;
  26.  
  27. extern char df0[], df1[], df2[], df3[], romfile[], prtname[]; 
  28.  
  29. #ifndef __unix
  30. extern void parse_cmdline(int argc, char **argv);
  31. #endif
  32.  
  33. #ifdef __mac__
  34. /* Apparently, no memcpy :-/ */
  35. static __inline__ void *memcpy(void *to, void *from, int size)
  36. {
  37.     BlockMove(from, to, size);
  38. }
  39. #endif
  40.  
  41. /* strdup() may be non-portable if you have a weird system */
  42. static char *my_strdup(const char*s)
  43. {
  44.     /* The casts to char * are there to shut up the compiler on HPUX */
  45.     char *x = (char*)malloc(strlen((char *)s) + 1);
  46.     strcpy(x, (char *)s);
  47.     return x;
  48. }
  49.  
  50. #undef REGPARAM
  51. #define fast_memcmp memcmp
  52. #define memcmpy generic_memcmpy
  53.  
  54. static __inline__ int generic_memcmpy(void *foo, const void *bar, int len)
  55. {
  56.     int res = memcmp(foo, bar, len);
  57.     if (res)
  58.     memcpy(foo, bar, len);
  59.     return res;
  60. }
  61.  
  62. #if defined(__GNUC_MINOR__)
  63.  
  64. #ifdef __i386__
  65.  
  66. #define INTEL_FLAG_OPT
  67.  
  68. #undef fast_memcmp
  69. #undef memcmpy
  70.  
  71. static __inline__ int fast_memcmp(const void *foo, const void *bar, int len)
  72. {
  73.     int differs, baz;
  74.     __asm__ __volatile__ ("subl $4, %2\n"
  75.               "jc  2f\n"
  76.               "1:\n"
  77.               "movl (%0),%%ebx\n"
  78.               "cmpl (%1),%%ebx\n"
  79.               "jne 5f\n"
  80.               "addl $4, %0\n"
  81.               "addl $4, %1\n"
  82.               "subl $4, %2\n"
  83.               "jnc  1b\n"
  84.               "2:\n"
  85.               "addl $4, %2\n"
  86.               "jz 4f\n"
  87.               "3:\n"
  88.               "movb (%0),%%bl\n"
  89.               "cmpb (%1),%%bl\n"
  90.               "jne 5f\n"
  91.               "incl %0\n"
  92.               "incl %1\n"
  93.               "decl %2\n"
  94.               "jnz 3b\n"
  95.               "4:\n"
  96.               "movl $0, %3\n"
  97.               "jmp 6f\n"
  98.               "5:\n"
  99.               "movl $1, %3\n"
  100.               "6:\n"
  101.               : "=&r" (foo), "=&r" (bar), "=&rm" (len), "=rm" (differs),
  102.                 "=&b" (baz)
  103.               : "0" (foo), "1" (bar), "2" (len), "3" (baz) : "cc");
  104.     return differs;
  105. }
  106.  
  107. static __inline__ int memcmpy(void *foo, const void *bar, int len)
  108. {
  109.     int differs, baz = 0, uupzuq = 0;
  110. /*    printf("%p %p %d\n", foo, bar, len);*/
  111.     __asm__ __volatile__ ("subl %1, %2\n"
  112.               "movl $0, %0\n"
  113.               "subl $16, %3\n"
  114.               "jc 7f\n"
  115.               
  116.               "8:\n"
  117.               "movl (%1),%%ecx\n"
  118.               "movl (%2,%1),%%ebx\n"
  119.               "xorl %%ebx, %%ecx\n"
  120.               "movl %%ebx, (%1)\n"
  121.               "orl %%ecx, %0\n"
  122.               
  123.               "movl 4(%2,%1),%%ebx\n"
  124.               "movl 4(%1),%%ecx\n"
  125.               "xorl %%ebx, %%ecx\n"
  126.               "movl %%ebx, 4(%1)\n"
  127.               "orl %%ecx, %0\n"
  128.               
  129.               "movl 8(%2,%1),%%ebx\n"
  130.               "movl 8(%1),%%ecx\n"
  131.               "xorl %%ebx, %%ecx\n"
  132.               "movl %%ebx, 8(%1)\n"
  133.               "orl %%ecx, %0\n"
  134.               
  135.               "movl 12(%2,%1),%%ebx\n"
  136.               "movl 12(%1),%%ecx\n"
  137.               "xorl %%ebx, %%ecx\n"
  138.               "movl %%ebx, 12(%1)\n"
  139.               "orl %%ecx, %0\n"
  140.               
  141.               "addl $16, %1\n"
  142.               "subl $16, %3\n"
  143.               "jnc  8b\n"
  144.               
  145.               "7:\n"
  146.               "addl $16, %3\n"
  147.               "subl $4, %3\n"
  148.               "jc  2f\n"
  149.               
  150.               "1:\n"
  151.               "movl (%2,%1),%%ebx\n"
  152.               "movl (%1),%%ecx\n"
  153.               "xorl %%ebx, %%ecx\n"
  154.               "movl %%ebx, (%1)\n"
  155.               "orl %%ecx, %0\n"
  156.               "addl $4, %1\n"
  157.               "subl $4, %3\n"
  158.               "jnc  1b\n"
  159.               
  160.               "2:\n"
  161.               "addl $4, %3\n"
  162.               "jz 6f\n"
  163.               "xorl %%ecx, %%ecx\n"
  164.               
  165.               "3:\n"
  166.               "movb (%2,%1),%%bl\n"
  167.               "movb (%1),%%cl\n"
  168.               "xorl %%bl,%%cl\n"
  169.               "movb %%bl,(%1)\n"
  170.               "orl %%ecx, %0\n"
  171.               "incl %1\n"
  172.               "decl %3\n"
  173.               "jnz 3b\n"
  174.               
  175.               "6:\n"
  176.               : "=m" (differs)
  177.               : "r" (foo), "r" (bar), "r" (len), "b" (baz), "c" (uupzuq) : "cc", "memory");
  178.     /* Now tell the compiler that foo, bar and len have been modified 
  179.      * If someone finds a way to express all this cleaner in constraints that
  180.      * GCC 2.7.2 understands, please FIXME */
  181.     __asm__ __volatile__ ("" : "=rm" (foo), "=rm" (bar), "=rm" (len) : :  "ebx", "ecx", "edx", "eax", "esi", "memory");
  182. /*    printf("bar\n");*/
  183.     return differs;
  184. }
  185. #endif
  186.  
  187. #if __GNUC__ > 2 || __GNUC_MINOR__ > 6
  188.  
  189. #if defined(__i386__) && !defined(USE_PROFILING)
  190. #define REGPARAM __attribute__((regparm(3)))
  191. #endif /* __i386__ */
  192.  
  193. #endif /* GCC version 2.7 or higher */
  194. #endif /* GCC 2 */
  195.  
  196. #ifndef REGPARAM
  197. #define REGPARAM
  198. #endif
  199.  
  200. /*#define EMULATE_AGA*/
  201.  
  202. #ifndef EMULATE_AGA
  203. #define AGA_CHIPSET 0
  204. #else
  205. #define AGA_CHIPSET 1
  206. #endif
  207.  
  208. #define SMART_UPDATE 1
  209.  
  210. /*
  211.  * Disk accesses can be sped up. This isn't such a big win, though.
  212.  * It hasn't been extensively tested and is turned off by default.
  213.  * (It's broken currently, even if it appears to work for most programs)
  214.  */
  215. #define NO_FAST_DISK
  216.  
  217. /*
  218.  * You can specify numbers from 0 to 5 here. It is possible that higher
  219.  * numbers will make the CPU emulation slightly faster, but if the setting
  220.  * is too high, you will run out of memory while compiling.
  221.  * Best to leave this as it is.
  222.  */
  223. #define CPU_EMU_SIZE 0
  224.  
  225. /*
  226.  * CPU level: 0 = 68000, 1 = 68010, 2 = sort of a 68020
  227.  * If configured for 68020, the emulator will be a little slower.
  228.  * Don't touch this: Only 0 will work for now.
  229.  */
  230. #define CPU_LEVEL 0
  231.  
  232.